package com.suixinsanren.design.state.demo.demo03;

public class NoQuarterState implements State {

    private final GumballMachine gumballMachine;

    public NoQuarterState(GumballMachine gumballMachine) {
        this.gumballMachine = gumballMachine;
    }

    @Override
    public void insertQuarter() {
        gumballMachine.setCurrentState(gumballMachine.getHasQuarterState());
    }

    @Override
    public void ejectQuarter() {
        System.out.println("无法退还硬币，您还没有投入硬币");
    }

    @Override
    public void turnCrank() {
        System.out.println("无法转动曲柄，您还没有投入硬币");
    }

    @Override
    public void dispense() {
        System.out.println("无法获取糖果，您还没有投入硬币");
    }

    @Override
    public void refill() {
    }

    @Override
    public String toString() {
        return "等待投入硬币";
    }
}
